package com.yangli.ahies.study.util;

/**
 * @author ly
 * @description
 * @data 2022/4/18
 */
public class DoubleNode {
    public int val;
    public DoubleNode pre;
    public DoubleNode next;
    public DoubleNode() {
    }

    public DoubleNode(int val) {
        this.val = val;
    }

    public DoubleNode(int val, DoubleNode pre,DoubleNode next) {
        this.val = val;
        this.next = next;
        this.pre = pre;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder(String.valueOf(this.val));
        DoubleNode temp = this.next;
        while (temp != null) {
            sb.append("<->").append(temp.val);
            temp = temp.next;
        }
        return sb.toString();
    }


}
